import resolve from '@rollup/plugin-node-resolve';
import commonjs from '@rollup/plugin-commonjs';
import { babel } from '@rollup/plugin-babel';
import terser from '@rollup/plugin-terser';
import json from '@rollup/plugin-json';

import builtins from 'rollup-plugin-node-builtins';
import globals from 'rollup-plugin-node-globals';

export default {
  input: 'src/index.js',
  output: [
    {
      file: 'dist/my-ogc.cjs.js',
      format: 'cjs',
    },
    {
      file: 'dist/my-ogc.esm.js',
      format: 'esm',
    },
    {
      file: 'dist/my-ogc.umd.js',
      format: 'umd',
      name: 'MyOGCPackage',
    }
  ],
  plugins: [
    resolve({
      browser: true,
      preferBuiltins: false
    }),
    globals(),
    builtins(),
    commonjs(),
    babel({
      exclude: 'node_modules/**',
      babelHelpers: 'bundled'
    }),
    terser(),
    json(),
  ]
};
